package com.sgj.watchingyou;

import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.util.Log;

public class ServiceStarter extends BroadcastReceiver {
	public ServiceStarter() {
	}

	@Override
	public void onReceive(Context context, Intent intent) {
		if(intent.getAction().equals("android.intent.action.BOOT_COMPLETED")){
			ComponentName cName = new ComponentName(context.getPackageName(), LocationRecorderService.class.getName());
			ComponentName svcName = context.startService(new Intent().setComponent(cName));

			if(svcName == null) {
				Log.d("error", "Service Start Failed");
			}  else {
				Log.d("OK", "Service Start Success");
			}
		}
	}
}
